import { getMVUrl, getMVDetail, getRelatedVideo } from "../../service/api_video"
Page({
    data: {
        mvUrlInfo: {},
        mvDetail: {},
        relatedVideo: [],
        danmuList: [{
            text: '有意思',
            color: '#ff0000',
            time: 1
        }, {
            text: '太有意思了',
            color: '#ff00ff',
            time: 3
        }],
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        const id = options.id
        this.getPageData(id)
    },

    getPageData(id) {
        // 请求播放地址
        getMVUrl(id).then(res => {
            this.setData({ mvUrlInfo: res.data.data })
        })
        // 请求视频信息
        getMVDetail(id).then(res => {
            this.setData({ mvDetail: res.data.data })
        })
        // 请求相关视频
        getRelatedVideo(id).then(res => {
            this.setData({ relatedVideo: res.data.data })
        })
    }

})